package com.ctos.ojbackendjudgeservice.judge.codeSandBox.impl;

import com.ctos.ojbackendjudgeservice.judge.codeSandBox.CodeSandBox;
import com.ctos.ojbackendmodel.codesandbox.ExecuteCodeRequest;
import com.ctos.ojbackendmodel.codesandbox.ExecuteCodeResponse;
import com.ctos.ojbackendmodel.dto.questionsubmit.JudgeInfo;
import com.ctos.ojbackendmodel.enums.QuestionSubmitStatusEnum;


import java.util.List;

/**
 * 示例代码沙箱
 */
public class ExampleCodeSandBox implements CodeSandBox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCoderequest) {
        List<String> inputList = executeCoderequest.getInputList();
        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage("测试通过");
        judgeInfo.setTime(100L);
        judgeInfo.setMemory(100L);

        executeCodeResponse.setJudgeInfo(judgeInfo);
        executeCodeResponse.setMessage("执行成功");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());

        return executeCodeResponse;
    }
}
